﻿@model FantasyBlog.DAL.Post
@{
    ViewBag.ShowSidebar = "false";
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.count = 1;
}
@section Header
{
    <script type="text/javascript" src="@Url.Content("~/Content/themes/base/comment-reply.js")"></script>
}
@helper CommentList(IQueryable<FantasyBlog.DAL.Comment> comments,bool first=false)
{
     foreach(var c in comments.FilterOpenedComments())
     {
         if (first && c.Parent != null)
         {
             continue;
         }
        <li class="comment byuser comment-author-@c.author bypostauthor even thread-odd thread-alt depth-1"
        id="li-comment-@ViewBag.count">
            <article id="comment-@ViewBag.count" class="comment">
                <footer class="comment-meta">
                    <div class="comment-author vcard">
                        <img alt="" src="@Url.Content("~/Content/themes/base/images/default_avatar.gif")"
                            class="avatar avatar-68 photo" height="39" width="39"><span class="fn">@c.author</span>
                        在 <a href="/Post/Details/@Model.ID/#comment-@ViewBag.count">
                            <time pubdate="" datetime="@c.date.ToString()">@c.date.ToString("yyyy-MM-dd HH:mm")</time></a>
                        <span class="says">说道：</span> <span class="edit-link"><a class="comment-edit-link"
                            href="http://ggtwlb0314.gicp.net/blog/wp-admin/comment.php?action=editcomment&amp;c=4"
                            title="编辑评论">编辑</a></span>
                    </div>
                    <!-- .comment-author .vcard -->
                </footer>
                <div class="comment-content">
                    <p>
                        @c.content</p>
                </div>
                <div class="reply">
                    <a class="comment-reply-link" href="/Post/Details/@Model.ID#comment-@ViewBag.count" onclick='return addComment.moveForm("comment-@ViewBag.count","@ViewBag.count","respond","@Model.ID")'>
                        回复 <span>↓</span></a>
                </div>
                <!-- .reply -->
            </article><!-- #comment-## -->
                     @{ViewBag.count++;}
                @if(c.Sons.Count>0)
                {
            <ul class="children">
                @CommentList(@c.Sons.AsQueryable())
            </ul>
                }
        </li>

    }
}
<nav id="nav-single">
    <h3 class="assistive-text">
        文章导航</h3>
@{
    var pre = @Model.Preview();
    if(pre!=null)
    {
    <span class="nav-previous"><a href="/Post/Details/@pre.ID"
        rel="prev"><span class="meta-nav">←</span> 上一篇</a></span> <span class="nav-next">
    </span>
    }
    var next = @Model.Next();
    if(next != null)
    {
        <span class="nav-next"><a href="/Post/Details/@next.ID"
         rel="next">下一篇 <span class="meta-nav">→</span></a></span>
    }
}
</nav>
<!-- #nav-single -->
<article id="post-12" class="post-12 post type-post status-publish format-standard hentry category-1">
    <header class="entry-header">
        <h1 class="entry-title">
            @Model.title</h1>
        <div class="entry-meta">
            <span class="sep">发表于 </span>
            <time class="entry-date" datetime="@Model.date.ToString()" pubdate>@Model.date.ToString("yyyy-MM-dd")</time>
            <span class="by-author"><span class="sep">由 </span><span class="author vcard"><a class="url fn n" href="/Post/Author/@Model.PostUser.username" title="查看所有由 @Model.PostUser.username 发布的文章" rel="author">@Model.PostUser.username</a>
            </span></span>
        </div>
        <!-- .entry-meta -->
    </header>
    <!-- .entry-header -->
    <div class="entry-content">
        @Model.content
    </div>
    <!-- .entry-content -->
    <footer class="entry-meta">
		此条目是由 <a href="/Post/author/@Model.PostUser.username">@Model.PostUser.username</a> 发表在 
        <a href="@Url.Content("~/Post/Category/" + Model.Category.name)"
            title="查看 @Model.Category.name 中的全部文章" rel="category tag">@Model.Category.name
            </a> 分类目录的。
            <span class="edit-link"><a class="post-edit-link" href="http://ggtwlb0314.gicp.net/blog/wp-admin/post.php?post=12&amp;action=edit"
                title="编辑文章">编辑</a> </span>
			</footer>
    <!-- .entry-meta -->
</article>
<!-- #post-12 -->
<div id="comments">

    <h2 id="comments-title">
        《<span>@Model.title</span>》上有 @Model.ApprovedComments().AsQueryable().Count() 条评论
    </h2>
    @if (Model.Comments.Count > 0)
    {
    <ol class="commentlist">
       @CommentList(@Model.ApprovedComments().AsQueryable(),true)
    </ol>
    }
    <div id="respond">
        <h3 id="reply-title">
            发表评论 <small><a rel="nofollow" id="cancel-comment-reply-link" href="/blog/2011/09/25/rs/#respond"
                style="display: none;">取消回复</a></small></h3>
        <form action="@Url.Content("~/Post/Comment")" method="post"
        id="commentform">
        @if (Request.IsAuthenticated)
        {
            <p class="logged-in-as">
                以 <a href="http://ggtwlb0314.gicp.net/blog/wp-admin/profile.php">@User.Identity.Name</a>
                的身份登录。<a href="/Account/LogOff" title="登出此账户">登出？</a></p>
        }
        else
        {
            <p class="comment-notes">
                电子邮件地址不会被公开。 必填项已用 <span class="required">*</span> 标注</p>							<p
                    class="comment-form-author">
                    <label for="author">
                        姓名</label>
                    <span class="required">*</span><input id="author" name="author" type="text" value=""
                        size="30" aria-required='true' /></p>
            <p class="comment-form-email">
                <label for="email">
                    电子邮件</label>
                <span class="required">*</span><input id="email" name="author_email" type="text" value=""
                    size="30" aria-required='true' /></p>
        }
        <p class="comment-form-comment">
            <label for="comment">
                评论</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>
  
        <p class="form-submit">
            <input name="submit" type="submit" id="submit" value="发表评论" />
            <input type='hidden' name='postid' value='@Model.ID' id='comment_post_ID' />
            <input type='hidden' name='parent' id='comment_parent' value='0' />

        </p>
                </p>
        </form>
    </div>
    <!-- #respond -->
</div>
<!-- #comments -->
